<?php
function getMhSign($params,$signKey)//签名方式
{
  ksort($params);
  $data = "";
  foreach ($params as $key => $value) {
    $data .= trim($value);
  }
  $sign = strtoupper(md5($data.$signKey));
  return $sign;
}

function checkMhSign($params,$signKey) //验签
{
  ksort($params);
  $psign = "";
  $data = "";
  foreach ($params as $key => $value) {
    if($key == "sign") {
		$psign = $value;
	} else {
		$data .= trim($value);
	}
  }
  $sign = strtoupper(md5($data.$signKey));
  if($psign == $sign) {
	  return true;
  } else {
	  return false;
  }
}